//
//  HSQMoreView.m
//  LiTianDecoration
//
//  Created by administrator on 2018/7/24.
//  Copyright © 2018年 administrator. All rights reserved.
//

#define  KBtnCount 4

#define  btnW 48

#define  btnH 68

#define KBtnMargin (KScreenWidth - KBtnCount * btnW) / (KBtnCount + 1)


#import "HSQMoreView.h"
#import "HSQCustomButton.h"

@interface HSQMoreView ()

@property (nonatomic, strong) HSQCustomButton *PhotoAlbum_Btn; // 相册

@property (nonatomic, strong) HSQCustomButton *Camera_Btn; // 相机


@end

@implementation HSQMoreView

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor clearColor];
        
        HSQCustomButton *PhotoAlbum_Btn = [HSQCustomButton buttonWithType:(UIButtonTypeCustom)];
        
        PhotoAlbum_Btn.alignmentType = Button_AlignmentStatusTop;
        
        [PhotoAlbum_Btn addTarget:self action:@selector(PhotoAlbum_BtnClick:) forControlEvents:UIControlEventTouchDown];
        
        [PhotoAlbum_Btn setTitle:@"相册" forState:UIControlStateNormal];
        
        [PhotoAlbum_Btn setTitleColor:RGB(71, 71, 71) forState:(UIControlStateNormal)];
        
        PhotoAlbum_Btn.titleLabel.font = [UIFont systemFontOfSize:12.0];
        
        [PhotoAlbum_Btn setImage:KImageName(@"photoImg") forState:(UIControlStateNormal)];
        
        PhotoAlbum_Btn.frame = CGRectMake(KBtnMargin, 10, btnW, btnH);
        
        [self addSubview:PhotoAlbum_Btn];
        
        self.PhotoAlbum_Btn = PhotoAlbum_Btn;
        
        HSQCustomButton *Camera_Btn = [HSQCustomButton buttonWithType:(UIButtonTypeCustom)];
        
        Camera_Btn.alignmentType = Button_AlignmentStatusTop;
        
        [Camera_Btn addTarget:self action:@selector(Camera_Btn_BtnClick:) forControlEvents:UIControlEventTouchDown];
        
        [Camera_Btn setTitle:@"相机" forState:UIControlStateNormal];
        
        [Camera_Btn setTitleColor:RGB(71, 71, 71) forState:(UIControlStateNormal)];
        
        Camera_Btn.titleLabel.font = [UIFont systemFontOfSize:12.0];
        
        [Camera_Btn setImage:KImageName(@"compose_camerabutton_background") forState:(UIControlStateNormal)];
        
        Camera_Btn.frame = CGRectMake(KBtnMargin * 2 + btnW , 10, btnW, btnH);
        
        [self addSubview:Camera_Btn];
        
        self.Camera_Btn = Camera_Btn;
    }
    
    return self;
}

/**
 * @brief 选择了相册
 */
- (void)PhotoAlbum_BtnClick:(UIButton *)sender{
    
    HSQLog(@"===选择了相册==");
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(KeyBoardPhotoAlbumBtnClickAction:)]) {
        
        [self.delegate KeyBoardPhotoAlbumBtnClickAction:sender];
    }
}

/**
 * @brief 选择了相机
 */
- (void)Camera_Btn_BtnClick:(UIButton *)sender{
    
    HSQLog(@"===选择了相机==");
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(KeyBoardCameraBtnClickAction:)]) {
        
        [self.delegate KeyBoardCameraBtnClickAction:sender];
    }
}

@end
